package cn.bdqn.service;

import cn.bdqn.domain.Admin;
import cn.bdqn.domain.Client;
import cn.bdqn.service.impl.AdminClientServiceImpl;
import cn.bdqn.utils.result.Page;
import cn.bdqn.utils.result.Result;
import cn.bdqn.utils.result.ResultGenerator;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.stereotype.Service;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;

/**
 *
 * @author dkj
 */
@Service
@FeignClient(name = "lms-client-admin",fallback = AdminClientServiceImpl.class)
public interface AdminClientService {

    //管理员

    /**
     * 添加管理员信息
     * @param admin
     * @return
     */
    @PostMapping("/admin/addInfo/")
    public Result addInfo(Admin admin);

    /**
     * 根据id查询管理员信息
     * @param id
     * @return
     */
    @GetMapping("/admin/queryInfoById/{id}")
    public Result queryInfoById(@PathVariable("id") Integer id);

    /**
     * 根据手机号和密码查询管理员信息
     * @return
     */
    @GetMapping("/admin/login/{password}/{phone}")
    public Result queryInfoByPhoneAndPassword(@PathVariable("password") String password,@PathVariable("phone") String phone);
    /**
     * 根据手机号查询   用于判断手机号是否注册
     * @param phone
     * @return
     */
    @GetMapping("/admin/queryByPhoneIsExist/{phone}")
    public Result queryByPhoneIsExist(@PathVariable("phone") String phone);
    /**
     * 查询全部并分页
     * @param pageNum
     * @param pageAmount
     * @return
     */
    @GetMapping("/admin/queryAllInfo/{pageNum}/{pageAmount}")
    public Result queryAllInfo(@PathVariable("pageNum") Integer pageNum,@PathVariable("pageAmount") Integer pageAmount);
    /**
     * 根据管理员名和手机号模糊查询并分页
     * @param name
     * @param phone
     * @param pageNum
     * @param pageAmount
     * @return
     */
    @GetMapping("/admin/queryInfoByNameOrPhone/{name}/{phone}/{pageNum}/{pageAmount}")
    public Result queryInfoByNameOrPhone(@PathVariable("name") String name,
                                         @PathVariable("phone") String phone,
                                         @PathVariable("pageNum") Integer pageNum,
                                         @PathVariable("pageAmount") Integer pageAmount);
    /**
     * 修改管理员信息
     * @param admin
     */
    @PutMapping("/admin/alterInfo")
    public Result alterInfo(Admin admin);

    /**
     * 逻辑删除管理员信息
     * @param id
     */
    @PutMapping("/admin/alterInfo/{id}")
    public Result alterStateById(@PathVariable("id") Integer id);



    //***********************客户**********************

    /**
     * 添加客户信息
     * @param client
     */
    @PostMapping("/client/addClientInfo/")
    public Result AddClientInfo(Client client);

    /**
     * 根据id查询用户信息
     *
     * @param id
     * @return
     */
    @GetMapping("/client/queryInfoById/{id}")
    public Result queryById(@PathVariable("id")Integer id);
    /**
     * 根据手机号查询客户信息
     * @param phone
     * @return
     */
    @GetMapping("/client/queryInfoByPhone/{phone}")
    public Result queryInfoByPhone(@PathVariable("phone") String phone);

    /**
     * 根据手机号判断手机号是否已注册
     *
     * @param phone 电话
     * @return
     */
    @GetMapping("/client/queryByPhoneIsExist/{phone}")
    public Result queryClientByPhoneIsExist(@PathVariable("phone")String phone);

    /**
     * 查询全部并分页
     *
     * @param pageNum   当前页码
     * @param pageAmount    每页条数
     * @return
     */
    @GetMapping("/client/queryAllInfo/{pageNum}/{pageAmount}")
    public Result queryAll(@PathVariable("pageNum")Integer pageNum, @PathVariable("pageAmount")Integer pageAmount);
    /**
     * 根据电话或姓名模糊查询信息并分页
     *
     * @param phone  客户电话
     * @param name   客户姓名
     * @param pageNum  当前页码
     * @param pageAmount  每页条数
     * @return
     */
    @GetMapping("/client/queryInfoByPhoneAndName/{phone}/{name}/{pageNum}/{pageAmount}")
    public Result queryInfoByPhoneAndName(@PathVariable("phone")String phone,
                                          @PathVariable("name") String name,
                                          @PathVariable("pageNum") Integer pageNum,
                                          @PathVariable("pageAmount") Integer pageAmount);

    /**
     * 逻辑删除
     * @param id 主键id
     * @return
     */
    @PutMapping("/client/alterStateById/{id}")
    public Result deleteStateById(@PathVariable("id")Integer id);

    /**
     * 修改客户信息
     *
     * @param client
     */
    @PutMapping("/client/alterInfo")
    public Result alterInfo(Client client);



}
